package zzs.generalframework.coder.core.encoder.temp.console.service;

import zzs.generalframework.coder.common.model.ClazzBO;

/**
 * @title
 * @description
 * @project zzs-coder
 * @package zzs.generalframework.coder.core.encoder.temp.console.service
 * @author zzs
 * @date 2018年1月31日
 * @version 1.0
 */
public class ImplementCoder
{

	public String createFile(ClazzBO clazzBO)
	{
		StringBuffer returnBuffer = new StringBuffer();

		if (clazzBO.getPackageName() != null)
		{
			// returnBuffer.append("package
			// ").append(clazzBO.getPackageName()).append(";").append("\n").append("\n");
		}

		if (clazzBO.getImportList() != null && clazzBO.getImportList().size() > 0)
		{
			for (String itemImport : clazzBO.getImportList())
			{
				// returnBuffer.append("import
				// ").append(itemImport).append(";").append("\n");
			}
		}

		returnBuffer.append("\n");

		// returnBuffer.append("public class
		// ").append(clazzBO.getClassName()).append("\n");
		// returnBuffer.append("{").append("\n");

		// private static final Logger logger =
		// LoggerFactory.getLogger(NationalityServiceImpl.class);
		// @Autowired
		// INationalityDao nationalityDao;
		// @Autowired
		// IBeanUtils beanUtils;

		returnBuffer.append("private Logger logger = LoggerFactory.getLogger(").append(clazzBO.getClassName()).append(".class);").append("\n");

		returnBuffer.append("@Autowired").append("\n");
		returnBuffer.append("BeanUtils beanUtils;").append("\n");
		returnBuffer.append("@Autowired").append("\n");
		returnBuffer.append("I").append(clazzBO.getEntityCode()).append("Dao ").append(clazzBO.getEntityCodeCamal()).append("Dao;").append("\n");

		// @Override
		// public ConsoleReturnBO saveNationality(NationalityBO nationalityBO)
		// {
		// logger.debug("======创建民族信息。入参：NationalityBO＝[{}]======",
		// nationalityBO);
		// ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();
		// NationalityPO nationalityPO = new NationalityPO();
		// copyNationalityBO2NationalityPO(nationalityBO, nationalityPO);
		// Boolean saveResult = nationalityDao.create(nationalityPO);
		// if(saveResult)
		// {
		// returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);
		// }

		// logger.debug("======创建民族信息。出参：ConsoleReturnBO＝[{}]======",
		// returnConsoleReturnBO);
		// return returnConsoleReturnBO;
		// }

		returnBuffer.append("@Override").append("\n");
		returnBuffer.append("public ConsoleReturnBO save").append(clazzBO.getEntityCode()).append("(").append(clazzBO.getEntityCode()).append("BO ").append(clazzBO.getEntityCodeCamal()).append("BO)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("logger.debug(\"====保存").append(clazzBO.getEntityName()).append("信息开始====\");").append("\n");
		returnBuffer.append("logger.debug(\"====保存").append(clazzBO.getEntityName()).append("信息.入参:").append(clazzBO.getEntityCode()).append("BO=[{}]====\", ").append(clazzBO.getEntityCodeCamal()).append("BO);").append("\n");
		returnBuffer.append("ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();").append("\n");
		returnBuffer.append(clazzBO.getEntityCode()).append("PO ").append(clazzBO.getEntityCodeCamal()).append("PO = new ").append(clazzBO.getEntityCode()).append("PO();").append("\n");
		returnBuffer.append("copy").append(clazzBO.getEntityCode()).append("BO2").append(clazzBO.getEntityCode()).append("PO(").append(clazzBO.getEntityCodeCamal()).append("BO, ").append(clazzBO.getEntityCodeCamal()).append("PO);").append("\n");
		returnBuffer.append("Boolean insertResult = ").append(clazzBO.getEntityCodeCamal()).append("Dao.insert(").append(clazzBO.getEntityCodeCamal()).append("PO);").append("\n");
		returnBuffer.append("if(insertResult)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("logger.debug(\"====保存").append(clazzBO.getEntityName()).append("信息.出参:ConsoleReturnBO=[{}]====\", returnConsoleReturnBO);").append("\n");
		returnBuffer.append("logger.info(\"====保存").append(clazzBO.getEntityName()).append("信息结束====\");").append("\n");
		returnBuffer.append("return returnConsoleReturnBO;").append("\n");
		returnBuffer.append("}").append("\n");

		// @Override
		// public ConsoleReturnBO saveNationality(List<NationalityBO>
		// nationalityBOList) throws ConsoleRollBackException
		// {
		// logger.debug("======创建民族信息。入参：List<NationalityBO>＝[{}]======",
		// nationalityBOList);
		// ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();
		// returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);
		// for(NationalityBO itemBO : nationalityBOList)
		// {
		// ConsoleReturnBO itemResult = saveNationality(itemBO);
		// if(ConsoleResult.FAILD.equals(itemResult.getResult()))
		// {
		// returnConsoleReturnBO.setResult(ConsoleResult.FAILD);
		// returnConsoleReturnBO.setMessage(itemResult.getMessage());
		// throw new ConsoleRollBackException();
		// }
		// }

		// logger.debug("======创建民族信息。出参：ConsoleReturnBO＝[{}]======",
		// returnConsoleReturnBO);
		// return returnConsoleReturnBO;
		// }
		returnBuffer.append("@Override").append("\n");
		returnBuffer.append("public ConsoleReturnBO save").append(clazzBO.getEntityCode()).append("(List<").append(clazzBO.getEntityCode()).append("BO> ").append(clazzBO.getEntityCodeCamal()).append("BOList)").append(" throws ConsoleException").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("logger.info(\"====保存").append(clazzBO.getEntityName()).append("信息列表开始====\");").append("\n");
		returnBuffer.append("logger.debug(\"====保存").append(clazzBO.getEntityName()).append("信息列表.入参:").append(clazzBO.getEntityCode()).append("BOList=[{}]====\", ").append(clazzBO.getEntityCodeCamal()).append("BOList);").append("\n");
		returnBuffer.append("ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);").append("\n");
		returnBuffer.append("for(").append(clazzBO.getEntityCode()).append("BO itemBO : ").append(clazzBO.getEntityCodeCamal()).append("BOList)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("ConsoleReturnBO itemResult = save").append(clazzBO.getEntityCode()).append("(itemBO);").append("\n");
		returnBuffer.append("if(ConsoleResult.FAILD.equals(itemResult.getResult()))").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.FAILD);").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setMessage(itemResult.getMessage());").append("\n");
		returnBuffer.append("throw new ConsoleRollbackException(itemResult.getMessage());").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("logger.debug(\"====保存").append(clazzBO.getEntityName()).append("信息列表.出参:ConsoleReturnBO=[{}]====\", returnConsoleReturnBO);").append("\n");
		returnBuffer.append("logger.info(\"====保存").append(clazzBO.getEntityName()).append("信息列表结束====\");").append("\n");
		returnBuffer.append("return returnConsoleReturnBO;").append("\n");
		returnBuffer.append("}").append("\n");

		// @Override
		// public ConsoleReturnBO getNationality(NationalityInfo
		// nationalityInfo)
		// {
		// logger.debug("======获取民族信息。入参：NationalityInfo＝[{}]======",
		// nationalityInfo);
		// ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();
		// List<NationalityPO> nationalityPOList =
		// nationalityDao.findByCondition(nationalityInfo);
		// if(nationalityPOList == null || nationalityPOList.size() == 0)
		// {
		// returnConsoleReturnBO.setMessage("未获取到记录");
		// }
		// else if(nationalityPOList.size() == 1)
		// {
		// returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);
		// NationalityBO nationalityBO = new NationalityBO();
		// copyNationalityPO2NationalityBO(nationalityPOList.get(0),
		// nationalityBO);
		// returnConsoleReturnBO.setReturnObj(nationalityBO);
		// }
		// else
		// {
		// returnConsoleReturnBO.setMessage("记录不唯一");
		// NationalityBO nationalityBO = new NationalityBO();
		// copyNationalityPO2NationalityBO(nationalityPOList.get(0),
		// nationalityBO);
		// returnConsoleReturnBO.setReturnObj(nationalityBO);
		// }
		// logger.debug("======获取民族信息。出参：ConsoleReturnBO＝[{}]======",
		// returnConsoleReturnBO);
		// return returnConsoleReturnBO;
		// }

		returnBuffer.append("@Override").append("\n");
		returnBuffer.append("public ConsoleReturnBO get").append(clazzBO.getEntityCode()).append("(").append(clazzBO.getEntityCode()).append("Info ").append(clazzBO.getEntityCodeCamal()).append("Info)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("logger.info(\"====获取").append(clazzBO.getEntityName()).append("信息开始====\");").append("\n");
		returnBuffer.append("logger.debug(\"====获取").append(clazzBO.getEntityName()).append("信息.入参:").append(clazzBO.getEntityCode()).append("Info=[{}]====\", ").append(clazzBO.getEntityCodeCamal()).append("Info);").append("\n");
		returnBuffer.append("ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();").append("\n");
		returnBuffer.append("List<").append(clazzBO.getEntityCode()).append("PO> ").append(clazzBO.getEntityCodeCamal()).append("POList = ").append(clazzBO.getEntityCodeCamal()).append("Dao.select(").append(clazzBO.getEntityCodeCamal()).append("Info);").append("\n");
		returnBuffer.append("if(").append(clazzBO.getEntityCodeCamal()).append("POList == null || ").append(clazzBO.getEntityCodeCamal()).append("POList.size() == 0)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setMessage(\"未获取到记录\");").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("else if(").append(clazzBO.getEntityCodeCamal()).append("POList.size() == 1)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);").append("\n");
		returnBuffer.append(clazzBO.getEntityCode()).append("BO ").append(clazzBO.getEntityCodeCamal()).append("BO = new ").append(clazzBO.getEntityCode()).append("BO();").append("\n");
		returnBuffer.append("copy").append(clazzBO.getEntityCode()).append("PO2").append(clazzBO.getEntityCode()).append("BO(").append(clazzBO.getEntityCodeCamal()).append("POList.get(0), ").append(clazzBO.getEntityCodeCamal()).append("BO);").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setReturnObj(").append(clazzBO.getEntityCodeCamal()).append("BO);").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("else").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setMessage(\"记录不唯一\");").append("\n");
		returnBuffer.append(clazzBO.getEntityCode()).append("BO ").append(clazzBO.getEntityCodeCamal()).append("BO = new ").append(clazzBO.getEntityCode()).append("BO();").append("\n");
		returnBuffer.append("copy").append(clazzBO.getEntityCode()).append("PO2").append(clazzBO.getEntityCode()).append("BO(").append(clazzBO.getEntityCodeCamal()).append("POList.get(0), ").append(clazzBO.getEntityCodeCamal()).append("BO);").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setReturnObj(").append(clazzBO.getEntityCodeCamal()).append("BO);").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("logger.debug(\"====获取").append(clazzBO.getEntityName()).append("信息.出参:ConsoleReturnBO=[{}]====\", returnConsoleReturnBO);").append("\n");
		returnBuffer.append("logger.info(\"====获取").append(clazzBO.getEntityName()).append("信息结束====\");").append("\n");
		returnBuffer.append("return returnConsoleReturnBO;").append("\n");
		returnBuffer.append("}").append("\n");

		// @Override
		// public ConsoleReturnBO listNationality(NationalityInfo
		// nationalityInfo)
		// {
		// logger.debug("======获取民族信息列表。入参：NationalityInfo＝[{}]======",
		// nationalityInfo);
		// ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();
		//
		// List<NationalityPO> nationalityPOList =
		// nationalityDao.findByCondition(nationalityInfo);
		//
		// if(nationalityPOList == null || nationalityPOList.size() == 0)
		// {
		// returnConsoleReturnBO.setMessage("未查询到相关记录");
		// }
		// else
		// {
		// returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);
		// List<NationalityBO> resultList = new ArrayList<NationalityBO>();
		// for(NationalityPO itemPO : nationalityPOList)
		// {
		// NationalityBO itemBO = new NationalityBO();
		// copyNationalityPO2NationalityBO(itemPO, itemBO);
		// resultList.add(itemBO);
		// }
		// returnConsoleReturnBO.setReturnObj(resultList);
		// }
		// logger.debug("======获取民族信息列表。出参：ConsoleReturnBO＝[{}]======",
		// returnConsoleReturnBO);
		// return returnConsoleReturnBO;
		// }

		returnBuffer.append("@Override").append("\n");
		returnBuffer.append("public ConsoleReturnBO list").append(clazzBO.getEntityCode()).append("(").append(clazzBO.getEntityCode()).append("Info ").append(clazzBO.getEntityCodeCamal()).append("Info)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("logger.info(\"====获取").append(clazzBO.getEntityName()).append("信息列表开始====\");").append("\n");
		returnBuffer.append("logger.debug(\"====获取").append(clazzBO.getEntityName()).append("信息列表.入参:").append(clazzBO.getEntityCode()).append("Info=[{}]====\", ").append(clazzBO.getEntityCodeCamal()).append("Info);").append("\n");
		returnBuffer.append("ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();").append("\n");
		returnBuffer.append("List<").append(clazzBO.getEntityCode()).append("PO> ").append(clazzBO.getEntityCodeCamal()).append("POList = ").append(clazzBO.getEntityCodeCamal()).append("Dao.select(").append(clazzBO.getEntityCodeCamal()).append("Info);").append("\n");
		returnBuffer.append("if(").append(clazzBO.getEntityCodeCamal()).append("POList == null || ").append(clazzBO.getEntityCodeCamal()).append("POList.size() == 0)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setMessage(\"未获取到记录\");").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("else").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);").append("\n");
		returnBuffer.append("List<").append(clazzBO.getEntityCode()).append("BO> resultList = new ArrayList<").append(clazzBO.getEntityCode()).append("BO>();").append("\n");
		returnBuffer.append("for(").append(clazzBO.getEntityCode()).append("PO itemPO : ").append(clazzBO.getEntityCodeCamal()).append("POList)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append(clazzBO.getEntityCode()).append("BO itemBO = new ").append(clazzBO.getEntityCode()).append("BO();").append("\n");
		returnBuffer.append("copy").append(clazzBO.getEntityCode()).append("PO2").append(clazzBO.getEntityCode()).append("BO(itemPO, itemBO);").append("\n");
		returnBuffer.append("resultList.add(itemBO);").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setReturnObj(resultList);").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("logger.debug(\"====获取").append(clazzBO.getEntityName()).append("信息列表.出参:ConsoleReturnBO＝[{}]====\", returnConsoleReturnBO);").append("\n");
		returnBuffer.append("logger.info(\"====获取").append(clazzBO.getEntityName()).append("信息列表结束====\");").append("\n");
		returnBuffer.append("return returnConsoleReturnBO;").append("\n");
		returnBuffer.append("}").append("\n");

		// @Override
		// public ConsoleReturnBO updateNationality(NationalityBO nationalityBO)
		// {
		// logger.debug("======更新民族信息。入参：NationalityBO＝[{}]======",
		// nationalityBO);
		// ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();

		// NationalityPO nationalityPO = new NationalityPO();
		// copyNationalityBO2NationalityPO(nationalityBO, nationalityPO);
		// Boolean updateResult = nationalityDao.update(nationalityPO);

		// if(updateResult)
		// {
		// returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);
		// }

		// logger.debug("======更新民族信息。出参：ConsoleReturnBO＝[{}]======",
		// returnConsoleReturnBO);
		// return returnConsoleReturnBO;
		// }
		returnBuffer.append("@Override").append("\n");
		returnBuffer.append("public ConsoleReturnBO update").append(clazzBO.getEntityCode()).append("(").append(clazzBO.getEntityCode()).append("BO ").append(clazzBO.getEntityCodeCamal()).append("BO)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("logger.info(\"====更新").append(clazzBO.getEntityName()).append("信息开始====\");").append("\n");
		returnBuffer.append("logger.debug(\"====更新").append(clazzBO.getEntityName()).append("信息.入参:").append(clazzBO.getEntityCode()).append("BO=[{}]====\", ").append(clazzBO.getEntityCodeCamal()).append("BO);").append("\n");
		returnBuffer.append("ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();").append("\n");
		returnBuffer.append("").append(clazzBO.getEntityCode()).append("PO ").append(clazzBO.getEntityCodeCamal()).append("PO = new ").append(clazzBO.getEntityCode()).append("PO();").append("\n");
		returnBuffer.append("copy").append(clazzBO.getEntityCode()).append("BO2").append(clazzBO.getEntityCode()).append("PO(").append(clazzBO.getEntityCodeCamal()).append("BO, ").append(clazzBO.getEntityCodeCamal()).append("PO);").append("\n");
		returnBuffer.append("Boolean updateResult = ").append(clazzBO.getEntityCodeCamal()).append("Dao.update(").append(clazzBO.getEntityCodeCamal()).append("PO);").append("\n");
		returnBuffer.append("if(updateResult)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("logger.debug(\"====更新").append(clazzBO.getEntityName()).append("信息.出参:ConsoleReturnBO=[{}]====\", returnConsoleReturnBO);").append("\n");
		returnBuffer.append("logger.info(\"====更新").append(clazzBO.getEntityName()).append("信息结束====\");").append("\n");
		returnBuffer.append("return returnConsoleReturnBO;").append("\n");
		returnBuffer.append("}").append("\n");

		// @Override
		// public ConsoleReturnBO updateNationality(List<NationalityBO>
		// nationalityBOList) throws ConsoleRollBackException
		// {
		// logger.debug("======更新民族信息列表。入参：List<NationalityBO>＝[{}]======",
		// nationalityBOList);
		// ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();
		// returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);
		// for(NationalityBO itemBO : nationalityBOList)
		// {
		// ConsoleReturnBO itemResult = updateNationality(itemBO);
		// if(ConsoleResult.FAILD.equals(itemResult.getResult()))
		// {
		// returnConsoleReturnBO.setResult(ConsoleResult.FAILD);
		// returnConsoleReturnBO.setMessage(itemResult.getMessage());
		// throw new ConsoleRollBackException();
		// }
		// }

		// logger.debug("======更新民族信息列表。出参：ConsoleReturnBO＝[{}]======",
		// returnConsoleReturnBO);
		// return returnConsoleReturnBO;
		// }

		returnBuffer.append("@Override").append("\n");
		returnBuffer.append("public ConsoleReturnBO update").append(clazzBO.getEntityCode()).append("(List<").append(clazzBO.getEntityCode()).append("BO> ").append(clazzBO.getEntityCodeCamal()).append("BOList) throws ConsoleException").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("logger.info(\"====更新").append(clazzBO.getEntityName()).append("信息列表开始====\");").append("\n");
		returnBuffer.append("logger.debug(\"====更新").append(clazzBO.getEntityName()).append("信息列表.入参:List<").append(clazzBO.getEntityCode()).append("BO>=[{}]====\", ").append(clazzBO.getEntityCodeCamal()).append("BOList);").append("\n");
		returnBuffer.append("ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);").append("\n");
		returnBuffer.append("for(").append(clazzBO.getEntityCode()).append("BO itemBO : ").append(clazzBO.getEntityCodeCamal()).append("BOList)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("ConsoleReturnBO itemResult = update").append(clazzBO.getEntityCode()).append("(itemBO);").append("\n");
		returnBuffer.append("if(ConsoleResult.FAILD.equals(itemResult.getResult()))").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.FAILD);").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setMessage(itemResult.getMessage());").append("\n");
		returnBuffer.append("throw new ConsoleRollbackException(itemResult.getMessage());").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("logger.debug(\"====更新").append(clazzBO.getEntityName()).append("信息列表.出参:ConsoleReturnBO=[{}]====\", returnConsoleReturnBO);").append("\n");
		returnBuffer.append("logger.info(\"====更新").append(clazzBO.getEntityName()).append("信息列表结束====\");").append("\n");
		returnBuffer.append("return returnConsoleReturnBO;").append("\n");
		returnBuffer.append("}").append("\n");

		// @Override
		// public ConsoleReturnBO removeNationality(NationalityBO nationalityBO)
		// {
		// logger.debug("======删除民族信息。入参：NationalityBO＝[{}]======",
		// nationalityBO);
		// ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();
		// NationalityPO nationalityPO = new NationalityPO();
		// copyNationalityBO2NationalityPO(nationalityBO, nationalityPO);
		// Boolean removeResult = nationalityDao.remove(nationalityPO);
		// if(removeResult)
		// {
		// returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);
		// }

		// logger.debug("======删除民族信息。出参：ConsoleReturnBO＝[{}]======",
		// returnConsoleReturnBO);
		// return returnConsoleReturnBO;
		// }
		returnBuffer.append("@Override").append("\n");
		returnBuffer.append("public ConsoleReturnBO remove").append(clazzBO.getEntityCode()).append("(").append(clazzBO.getEntityCode()).append("BO ").append(clazzBO.getEntityCodeCamal()).append("BO)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("logger.info(\"====删除").append(clazzBO.getEntityName()).append("信息开始====\");").append("\n");
		returnBuffer.append("logger.debug(\"====删除").append(clazzBO.getEntityName()).append("信息.入参:").append(clazzBO.getEntityCode()).append("BO＝[{}]======\", ").append(clazzBO.getEntityCodeCamal()).append("BO);").append("\n");
		returnBuffer.append("ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();").append("\n");
		returnBuffer.append(clazzBO.getEntityCode()).append("PO ").append(clazzBO.getEntityCodeCamal()).append("PO = new ").append(clazzBO.getEntityCode()).append("PO();").append("\n");
		returnBuffer.append("copy").append(clazzBO.getEntityCode()).append("BO2").append(clazzBO.getEntityCode()).append("PO(").append(clazzBO.getEntityCodeCamal()).append("BO, ").append(clazzBO.getEntityCodeCamal()).append("PO);").append("\n");
		returnBuffer.append("Boolean deleteResult = ").append(clazzBO.getEntityCodeCamal()).append("Dao.delete(").append(clazzBO.getEntityCodeCamal()).append("PO);").append("\n");
		returnBuffer.append("if(deleteResult)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("logger.debug(\"====删除").append(clazzBO.getEntityName()).append("信息.出参:ConsoleReturnBO=[{}]====\", returnConsoleReturnBO);").append("\n");
		returnBuffer.append("logger.info(\"====删除").append(clazzBO.getEntityName()).append("信息结束====\");").append("\n");
		returnBuffer.append("return returnConsoleReturnBO;").append("\n");
		returnBuffer.append("}").append("\n");

		// @Override
		// public ConsoleReturnBO removeNationality(List<NationalityBO>
		// nationalityBOList) throws ConsoleRollBackException
		// {
		// logger.debug("======删除民族信息列表。入参：List<NationalityBO>＝[{}]======",
		// nationalityBOList);
		// ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();
		// returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);
		// for(NationalityBO itemBO : nationalityBOList)
		// {
		// ConsoleReturnBO itemResult = removeNationality(itemBO);
		// if(ConsoleResult.FAILD.equals(itemResult.getResult()))
		// {
		// returnConsoleReturnBO.setResult(ConsoleResult.FAILD);
		// returnConsoleReturnBO.setMessage(itemResult.getMessage());
		// throw new ConsoleRollBackException();
		// }
		// }
		// logger.debug("======删除民族信息列表。出参：ConsoleReturnBO＝[{}]======",
		// returnConsoleReturnBO);
		// return returnConsoleReturnBO;
		// }
		returnBuffer.append("@Override").append("\n");
		returnBuffer.append("public ConsoleReturnBO remove").append(clazzBO.getEntityCode()).append("(List<").append(clazzBO.getEntityCode()).append("BO> ").append(clazzBO.getEntityCodeCamal()).append("BOList) throws ConsoleException").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("logger.info(\"====删除").append(clazzBO.getEntityName()).append("信息列表开始====\");").append("\n");
		returnBuffer.append("logger.debug(\"====删除").append(clazzBO.getEntityName()).append("信息列表.入参:List<").append(clazzBO.getEntityCode()).append("BO>＝[{}]======\", ").append(clazzBO.getEntityCodeCamal()).append("BOList);").append("\n");
		returnBuffer.append("ConsoleReturnBO returnConsoleReturnBO = new ConsoleReturnBO();").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.SUCCESS);").append("\n");
		returnBuffer.append("for(").append(clazzBO.getEntityCode()).append("BO itemBO : ").append(clazzBO.getEntityCodeCamal()).append("BOList)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("ConsoleReturnBO itemResult = remove").append(clazzBO.getEntityCode()).append("(itemBO);").append("\n");
		returnBuffer.append("if(ConsoleResult.FAILD.equals(itemResult.getResult()))").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setResult(ConsoleResult.FAILD);").append("\n");
		returnBuffer.append("returnConsoleReturnBO.setMessage(itemResult.getMessage());").append("\n");
		returnBuffer.append("throw new ConsoleRollbackException(itemResult.getMessage());").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("logger.debug(\"====删除").append(clazzBO.getEntityName()).append("信息列表.出参:ConsoleReturnBO＝[{}]====\", returnConsoleReturnBO);").append("\n");
		returnBuffer.append("logger.info(\"====删除").append(clazzBO.getEntityName()).append("信息列表结束====\");").append("\n");
		returnBuffer.append("return returnConsoleReturnBO;").append("\n");
		returnBuffer.append("}").append("\n");

		// @Override
		// public Long countNationality(NationalityBO nationalityBO)
		// {
		// logger.debug("======统计民族信息。入参：NationalityBO＝[{}]======",
		// nationalityBO);
		// Long returnLong = new Long(0);
		// NationalityPO nationalityPO = new NationalityPO();
		// copyNationalityBO2NationalityPO(nationalityBO, nationalityPO);
		// returnLong = nationalityDao.count(nationalityPO);
		// logger.debug("======统计民族信息。出参：Long＝[{}]======", returnLong);
		// return returnLong;
		// }
		returnBuffer.append("@Override").append("\n");
		returnBuffer.append("public Long count").append(clazzBO.getEntityCode()).append("(").append(clazzBO.getEntityCode()).append("BO ").append(clazzBO.getEntityCodeCamal()).append("BO)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("logger.info(\"====统计").append(clazzBO.getEntityName()).append("信息开始====\");").append("\n");
		returnBuffer.append("logger.debug(\"====统计").append(clazzBO.getEntityName()).append("信息。入参：").append(clazzBO.getEntityCode()).append("BO＝[{}]======\", ").append(clazzBO.getEntityCodeCamal()).append("BO);").append("\n");
		returnBuffer.append("Long returnLong = new Long(0);").append("\n");
		returnBuffer.append(clazzBO.getEntityCode()).append("PO ").append(clazzBO.getEntityCodeCamal()).append("PO = new ").append(clazzBO.getEntityCode()).append("PO();").append("\n");
		returnBuffer.append("copy").append(clazzBO.getEntityCode()).append("BO2").append(clazzBO.getEntityCode()).append("PO(").append(clazzBO.getEntityCodeCamal()).append("BO, ").append(clazzBO.getEntityCodeCamal()).append("PO);").append("\n");
		returnBuffer.append("returnLong = ").append(clazzBO.getEntityCodeCamal()).append("Dao.count(").append(clazzBO.getEntityCodeCamal()).append("PO);").append("\n");
		returnBuffer.append("logger.debug(\"====统计").append(clazzBO.getEntityName()).append("信息.出参:Long＝[{}]======\", returnLong);").append("\n");
		returnBuffer.append("logger.info(\"====统计").append(clazzBO.getEntityName()).append("信息结束====\");").append("\n");
		returnBuffer.append("return returnLong;").append("\n");
		returnBuffer.append("}").append("\n");

		// private void copyNationalityBO2NationalityPO(NationalityBO
		// nationalityBO, NationalityPO nationalityPO)
		// {
		// beanUtils.copyBeanNotNull(nationalityBO, nationalityPO);
		// if(nationalityBO.getSysID() != null)
		// {
		// nationalityPO.setSeqID(nationalityBO.getSysID());
		// }
		// }
		returnBuffer.append("private void copy").append(clazzBO.getEntityCode()).append("BO2").append(clazzBO.getEntityCode()).append("PO(").append(clazzBO.getEntityCode()).append("BO ").append(clazzBO.getEntityCodeCamal()).append("BO, ").append(clazzBO.getEntityCode()).append("PO ").append(clazzBO.getEntityCodeCamal()).append("PO)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("beanUtils.copyBeanNotNull(").append(clazzBO.getEntityCodeCamal()).append("BO, ").append(clazzBO.getEntityCodeCamal()).append("PO);").append("\n");
		returnBuffer.append("if(").append(clazzBO.getEntityCodeCamal()).append("BO.getSysID() != null)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("").append(clazzBO.getEntityCodeCamal()).append("PO.setSeqID(").append(clazzBO.getEntityCodeCamal()).append("BO.getSysID());").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("}").append("\n");

		// private void copyNationalityPO2NationalityBO(NationalityPO
		// nationalityPO, NationalityBO nationalityBO)
		// {
		// beanUtils.copyBeanNotNull(nationalityPO, nationalityBO);
		// if(nationalityPO.getSeqID() != null)
		// {
		// nationalityBO.setSysID(nationalityPO.getSeqID());
		// }
		// }
		returnBuffer.append("private void copy").append(clazzBO.getEntityCode()).append("PO2").append(clazzBO.getEntityCode()).append("BO(").append(clazzBO.getEntityCode()).append("PO ").append(clazzBO.getEntityCodeCamal()).append("PO, ").append(clazzBO.getEntityCode()).append("BO ").append(clazzBO.getEntityCodeCamal()).append("BO)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("beanUtils.copyBeanNotNull(").append(clazzBO.getEntityCodeCamal()).append("PO, ").append(clazzBO.getEntityCodeCamal()).append("BO);").append("\n");
		returnBuffer.append("if(").append(clazzBO.getEntityCodeCamal()).append("PO.getSeqID() != null)").append("\n");
		returnBuffer.append("{").append("\n");
		returnBuffer.append("").append(clazzBO.getEntityCodeCamal()).append("BO.setSysID(").append(clazzBO.getEntityCodeCamal()).append("PO.getSeqID());").append("\n");
		returnBuffer.append("}").append("\n");
		returnBuffer.append("}").append("\n");

		// returnBuffer.append("}").append("\n");

		return returnBuffer.toString();
	}

}
